package com.bustle.user.dto.address;

import javax.ejb.Local;
import javax.ejb.Stateless;

import com.bustle.commons.MapConverter;
import com.bustle.user.data.Address;

@Local
public interface DtoToAddressMapConverter extends MapConverter<AddressDto, Address>
{
  @Stateless
  public class DefaultDtoToAddressMapConverter extends AbstractMapConverter<AddressDto, Address> implements DtoToAddressMapConverter
  {
    @Override
    public void doMapping(AddressDto aSource, Address aDestination)
    {
      aDestination.setId(aSource.getId());
      aDestination.setName_street(aSource.getName());
      aDestination.setCity(aSource.getCity());
      aDestination.setPostcode(aSource.getPostcode());
    }

    @Override
    protected Address build()
    {
      return new Address();
    }
  }
}